package com.example.demo2;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import static java.lang.System.exit;

public class dtMainActivity extends AppCompatActivity {

   // Bundle bundle = new Bundle();
   // ArrayList list2 = new ArrayList();
   // ArrayList list = bundle.getParcelableArrayList("List");
//public static List<Activity> activities = new LinkedList<>();

    private Button but1,but2,but3;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dt_main);
        but1 = (Button)findViewById(R.id.but1);
        but2 = (Button)findViewById(R.id.but2);
        but3 = (Button)findViewById(R.id.but3);
//        Bundle bundle = getIntent().getExtras();
//        ArrayList<username> userArrayList = (ArrayList<username>) bundle.getSerializable("key");
        but1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(dtMainActivity.this,zcMainActivity.class);
                startActivityForResult(intent,1);
            }
        });
        but2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle = getIntent().getExtras();
                ArrayList<username> userArrayList = (ArrayList<username>) bundle.getSerializable("key");
//                bundle.putParcelableArrayList("List1",list);
                    Bundle bundle1 = new Bundle();
                    bundle1.putSerializable("key", userArrayList);
                    Intent intent = new Intent(dtMainActivity.this,drMainActivity.class);
                    intent.putExtras(bundle);
                    startActivityForResult(intent,1);
            }
        });
        but3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setAction(intent.ACTION_MAIN);
                intent.addCategory(intent.CATEGORY_HOME);
                startActivity(intent);
            }
        });
    }

}
